<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Encore\Admin\Traits\AdminBuilder;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use App\Models\Squad;
use Illuminate\Database\Eloquent\SoftDeletes;

class Test_config extends Model
{
    use SoftDeletes;
    //考勤周期配置模型
	public $timestamps = false;
    //
    protected $fillable = [
        'start_time','end_time','name', 'total_score', 'grace_days','status','create_user','deleted_at','type'
    ];

    protected $dates = ['delete_at'];

    public function squads() : BelongsToMany
    {
        return $this->belongsToMany(Squad::class, 'test_assigns', 'test_config_id', 'squad_id');
    }

    public function student_mark()
    {
        return $this->hasToMany(Student_mark::class);
    }

    public function test_reports()
    {
        return $this->hasMany(Test_report::class);
    }
}
